import {createApp} from 'vue'
import './styles/index.scss' // 自定义的风格
import 'element-plus/dist/index.css' // ep的 css 风格
import App from './App.vue'
import router from "./router/index.js";
import "@/router/permission.js"
import pinaPluginPersistence from 'pinia-plugin-persistedstate'
// 导入国际化语言插件
import i18n from "@/i18n/index.js";

// 自定义 svg 组件
import 'virtual:svg-icons-register'
import SvgIcon from "@/components/SvgIcon/index.vue"

// 导入所有的element-plus svg图标
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

// 全局函数导出
import filters from "@/utilities/filters.js";

// 创建 pinia
import {createPinia} from "pinia";

const pinia = createPinia()
pinia.use(pinaPluginPersistence)


const myApp = createApp(App)
// 注册全局函数
filters(myApp)
myApp.use(pinia)
myApp.use(router)
// 全局导入 element-plus svg 图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    myApp.component(key, component)
}
myApp.use(i18n)
// 全局使用自定义的 svg 组件
myApp.component('SvgIcon', SvgIcon)
myApp.mount('#app')
